let s = 'fgh'
let l = 'abcde'

let arrS = [...s]
let arrL = [...l]


console.log(arrS)
console.log(arrL)


let indexS = 0
let indexL = 0

while(indexS < arrS.length && indexL < arrL.length){
    if(arrS[indexS] == arrL[indexL]){
        indexS++
    }
    indexL++
}
console.log('indexS:', indexS)
console.log('indexL:', indexL)
if(indexS == arrS.length){
    console.log('是有效子串')
}else{
    console.log('不是')
}